from flask import Flask
from app.config import config
from app.extensions import config_extensions
from app.apis import config_resource
from app import models

def create_app(config_name='default'):
    app = Flask(__name__)

    if config_name not in config:
        config_name = "default"

    app.config.from_object(config[config_name])

    config_extensions(app)

    config_resource(app)

    return app